<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	List<TblRegExpress> list = (List<TblRegExpress>)request.getAttribute("list");
	ExpressForm form = (ExpressForm)request.getAttribute("command");
	String addtimeStart = StringUtils.isNotBlank(form.getAddtimeStart())?form.getAddtimeStart():"";
	String addtimeEnd = StringUtils.isNotBlank(form.getAddtimeEnd())?form.getAddtimeEnd():"";
    String username = StringUtils.isNotBlank(form.getUsername())?form.getUsername():"";
    String exnum = StringUtils.isNotBlank(form.getExnum())?form.getExnum():"";
	UserInfo user = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
%>

<div class="userListWrap" id="userListWrap">
	
	<form id="userListForm">
		
        <div class="form-item">
    		<label for="exnum">快递单号:</label>
    		<input class="easyui-validatebox" type="text" style="width:140px" name="exnum" data-options="" value="<%= exnum%>"/>
        </div>
       	<div class="form-item form-item-two">
    		<label for="addtime">访问时间:</label>
    		<input id="addtimeStart" name="addtimeStart" class="easyui-validatebox" type="text" style="width:100px"  onClick="WdatePicker({errDealMode:1,dateFmt:'yyyy-M-d',minDate:'2017-1-1',maxDate:'%y-%M-%d'})" value="<%= addtimeStart%>">--
    		<input id="addtimeEnd" name="addtimeEnd" class="easyui-validatebox" type="text" style="width:100px"  onClick="WdatePicker({errDealMode:1,dateFmt:'yyyy-M-d',minDate:'2017-1-1',maxDate:'%y-%M-%d'})" value="<%= addtimeEnd%>">
        </div>
        <div class="form-item" style="width:80px">
    		<a href="javascript:XF.Visitor.listExpressSearch()" class="input-btn-microsoft input-btn-microsoft-24">搜索</a>
        </div>  
    </form>

    <table id="expressListTable" class="easyui-datagrid"  title="" >
        <thead>
    		<tr>
				<th data-options="field:'vname',width:180">快递公司</th>				
				<th data-options="field:'certtype',width:180">快递单号</th>			
				<th data-options="field:'visittime',width:150" >访问时间</th>
				<th data-options="field:'username',width:80" >值班保安</th>
				<th data-options="field:'pro',width:180">操作</th>				
      		</tr>
        </thead>
        <tbody>
        	<%
        		if(list!=null && list.size() > 0){
        			for(TblRegExpress express:list){
        				%>
       					 <tr s="<%=express.getExid() %>"> 					 	      					 	
       					 	<td><i s="<%=express.getExid() %>"></i><%=(null!=express.getExcompany())?express.getExcompany()+"":"" %></td>       					 	
       					 	<td><%=(null!=express.getExnum())?express.getExnum()+"":"" %></td>
       					 	<td><%=null!=express.getAddtime()?DateFormatUtils.format(express.getAddtime().getTime(), "yyyy-MM-dd HH:mm:ss"):"" %></td>
       					 	<td><%=(null!=express.getUsername())?express.getUsername()+"":"" %></td>
       					 	<td>
									<a class="inLink" href="javascript:XF.Visitor.editExpress('<%=express.getExid()+"" %>')"><span>编辑</span></a>
									<a class="inLink" href="javascript:XF.Visitor.deleteExpress('<%=express.getExid()+"" %>','<%=user.getEmployId()+"" %>')"><span>删除</span></a>										
							</td>
			    		</tr>
        				<%
        			}
        		}
        	%>
    	</tbody>
    </table>
    <div class="pagination">
		<monggoTag:pagination 
		href="express_search"
		pageSize="<%=form.getPageSize()%>" 
		totalRecord="<%=form.getTotalRecord() %>" 
		currentPage="<%=form.getPageNum() %>">
		</monggoTag:pagination> 
	</div>
</div>
<script>
	$('#expressListTable').datagrid();
	<%-- $("#addtimeStart").datebox({
		formatter:XF.dateFormatter,
		parser:XF.dateParse
	});
	
	<%
	if(StringUtils.isNotBlank(addtimeStart)){
		%>
			$("#addtimeStart").datebox("setValue","<%=addtimeStart%>");
		<%
	}
	%> 
	
	$("#addtimeEnd").datebox({
		formatter:XF.dateFormatter,
		parser:XF.dateParse
	});
	
	<%
	if(StringUtils.isNotBlank(addtimeEnd)){
		%>
			$("#addtimeEnd").datebox("setValue","<%=addtimeEnd%>");
		<%
	}
	%>  --%>
</script>